package com.bowen.spike.context;


/**
 *  线程上下文
 */
public class UserContext {
    private static final ThreadLocal<Long> threadlocal = new ThreadLocal<>();

    public static void saveUserId(Long userId) {
        threadlocal.set(userId);
    }

    public static Long getUserId() {
        return threadlocal.get();
    }

    public static void clear() {
        threadlocal.remove();
    }
}
